#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2019 crane <crane@gosun>
#
# Distributed under terms of the MIT license.

"""

"""

class Node:
    def __init__(self, value):
        self.value = value
        self.left = self.right = None

def build():
    #       0
    #   1       2
    # 3   4   5   6
    root = Node(0)
    root.left = Node(1)
    root.right = Node(2)

    root.left.left = Node(3)
    root.left.right = Node(4)

    root.right.left = Node(5)
    root.right.right = Node(6)

    return root

def bfs(root):
    queue = [root]

    while queue:
        cur = queue.pop(0)
        print(cur.value)

        if cur.left:
            queue.append(cur.left)

        if cur.right:
            queue.append(cur.right)

def test():
    tree = build()
    bfs(tree)

def main():
    print("start main")
    test()

if __name__ == "__main__":
    main()
